<?php
namespace org\phpstruct\core\exceptions;
use org\phpstruct\core;
/* 
 *  Copyright (C) 2010 Emanuele Colonnelli <emanuele.colonnelli@phpstruct.com>
 * 
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * Description of XMapException
 *
 * @author Emanuele Colonnelli <emanuele.colonnelli@phpstruct.com>
 */
class XMapException extends \Exception {

  public function __construct() {
	
	$errors = \libxml_get_errors();
	
	foreach($errors as $e) {
	  $this->message .= "[XMAP ERROR][File: {$e->file}]\n";
	  $this->message .= "[XMAP ERROR][Line: {$e->line}]\n";
	  $this->message .= "[XMAP_ERROR][Code: {$e->code}]\n";
	  $this->message .= "[XMAP_ERROR][Level: {$e->level}]\n";
	  $this->message .= "[XMAP_ERROR][Message: {$e->message}]\n\n";
	}
	$this->code = \org\phpstruct\core\ERROR_XML_XMAP_VALIDATION;
	parent::__construct($this->message, $this->code, null);
  }

}
